<!--#
layout("/layouts/platform.html"){
#-->
<style>
    .left_aside {
        width: 132px;
        height: 500px;
    }

    .left_tree {
        margin-top: 10px;
        margin-left: -5px;
    }

    /*当前分类标识颜色*/
    /*.left_tree .is-current .el-tree-node__content{*/
    /*    background-color: #F5F7FA;*/
    /*}*/

    .el-tree-node {
        padding-top: 7px;
    }

    .note {
        width: 100%;
        height: 320px;
    }

    .el-upload input[type=file] {
        display: none;
    }

    .avatar-uploader .el-upload {
        border: 1px dashed #d9d9d9;
        border-radius: 6px;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }

    .avatar-uploader .el-upload:hover {
        border-color: #409EFF;
    }

    .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 128px;
        height: 128px;
        line-height: 128px;
        text-align: center;
    }

    .avatar {
        width: 128px;
        height: 128px;
        display: block;
    }
</style>
<div id="app" v-cloak>

    <el-row class="el-table-container">
        <el-form :model="formData" style="margin: 0 50px" :rules="formRules" label-width="250px" label-position="left">
            <el-row>
                <el-col :span="12">
                    <div class="grid-content bg-purple">
                        <el-collapse accordion>
                            <!--邮箱配置-->
                            <el-collapse-item title="邮箱配置">
                                <el-form-item prop="emailHost" label="邮箱地址">
                                    <el-input maxlength="32"
                                              placeholder="请输入邮箱地址"
                                              v-model="formData.emailHost"
                                              type="text">
                                    </el-input>
                                </el-form-item>
                                <el-form-item prop="emailPort" label="邮箱端口">
                                    <el-input maxlength="32"
                                              placeholder="请输入邮箱端口"
                                              v-model="formData.emailPort"
                                              type="number">
                                    </el-input>
                                </el-form-item>
                                <el-form-item prop="emailUser" label="用户">
                                    <el-input maxlength="32"
                                              placeholder="请输入用户"
                                              v-model="formData.emailUser"
                                              type="text">
                                    </el-input>
                                </el-form-item>
                                <el-form-item prop="emailPassword" label="密码">
                                    <el-input maxlength="32"
                                              placeholder="请输入密码"
                                              v-model="formData.emailPassword"
                                              show-password
                                              type="text">
                                    </el-input>
                                </el-form-item>
                                <el-form-item prop="emailTitle" label="邮件标题">
                                    <el-input maxlength="32"
                                              placeholder="请输入邮件标题"
                                              v-model="formData.emailTitle"
                                              type="text">
                                    </el-input>
                                </el-form-item>
                                <el-form-item prop="emailContent" label="邮件内容">
                                    <el-input maxlength="128"
                                              placeholder="邮件内容"
                                              v-model="formData.emailContent"
                                              type="textarea">
                                    </el-input>
                                </el-form-item>
                                <el-form-item prop="emailReceiver" label="邮件接收人">
                                    <el-input maxlength="128"
                                              placeholder="邮件接收人"
                                              v-model="formData.emailReceiver"
                                              type="textarea">
                                    </el-input>
                                </el-form-item>
                            </el-collapse-item>
                        </el-collapse>
                    </div>
                </el-col>
            </el-row>
        </el-form>
    </el-row>
    <el-foot>
        <el-col :span="8">
            <div class="grid-content bg-purple">
                <span>&nbsp;</span>
            </div>
        </el-col>
        <el-col :span="8">
            <div class="grid-content bg-purple-light">
                <el-button @click="forDefault()">恢复默认</el-button>
                <el-button @click="init()">重置</el-button>
                <el-button type="primary" @click="doEdit">确 定</el-button>
            </div>
        </el-col>
        <el-col :span="8">
            <div class="grid-content bg-purple">
                <span>&nbsp;</span>
            </div>
        </el-col>
    </el-foot>
</div>
<script>
    let paramVerify = new Vue({
        el: "#app",
        data: function () {
            let self = this;
            return {
                formData: {
                    debug: true,
                    delFlag: false,
                    emailContent: "CODE:[%s]",
                    emailReceiver:"",
                    emailHost: "smtp.yishenhan.cn",
                    emailPassword: "test1234",
                    emailPort: 25,
                    emailTitle: "BALL-GOLDEN",
                    emailUser: "test@yishenhan.cn",
                    ercApiKey: "IKK1B5Q5ZPDKVUYE9RUJCBN53RVKZHXXJQ",
                    ercUrl: "http://api-cn.etherscan.com/",
                    ftpHost: "192.168.0.122",
                    ftpPassword: "123456",
                    ftpPort: 21,
                    ftpUploadPath: "/upload/",
                    ftpUserName: "test",
                    fullPdFormula: "50/rate",
                    fullScoreFormula: "10/rate",
                    groupLogKeepDayNumber: 30,
                    halfPdFormula: "20/rate",
                    id: "4eb3865e029f495f9c8677cee17255e0",
                    isNeedInviteCode: false,
                    levelRate: 50,
                    loginValidTime: 60,
                    oneWalletRechargeNotifyUrl: "http://xulh.ngrok.wendal.cn/open/oneWallet/recharge/notify",
                    oneWalletSafeCode: "QyCqaNGPgw3hPtASm4eE6g==",
                    oneWalletToPayUrl: "https://api-tg.100scrop.tech/92-d10/SH/sendPay",
                    oneWalletToWithDrawUrl: "https://api-tg.100scrop.tech/92-d10/SH/sendWithdraw",
                    oneWalletWithDrawNotifyUrl: "http://xulh.ngrok.wendal.cn/open/oneWallet/withdraw/notify",
                    opAt: 1603347788,
                    opBy: "",
                    rebateValidLayer: 10,
                    recruitAmount: 100000,
                    serviceFee: 5,
                    superRate: 1000,
                    userChatMsgKeepDayNumber: 30,
                    withdrawFee: 1.25,
                    xindovndMerchant: "a56d0a95970f4defb43e9faa1630a601",
                    xindovndPaytype: "promptpay",
                    xindovndRechargeNotifyUrl: "http://xulh.ngrok.wendal.cn/open/xindovnd/recharge/notify",
                    xindovndSecret: "e86523fe319c4232a168b13e99984d04",
                    xindovndToPayUrl: "http://www.xindovnd.com/pay",
                    xindovndToWithdrawUrl: "http://www.xindovnd.com/transfer/apply",
                    xindovndWithdrawNotifyUrl: "http://xulh.ngrok.wendal.cn/open/xindovnd/withdraw/notify"
                },
                defaultFormData: {
                    debug: true,
                    delFlag: false,
                    emailContent: "CODE:[%s]",
                    emailHost: "smtp.yishenhan.cn",
                    emailPassword: "test1234",
                    emailPort: 25,
                    emailTitle: "BALL-GOLDEN",
                    emailUser: "test@yishenhan.cn",
                    ercApiKey: "IKK1B5Q5ZPDKVUYE9RUJCBN53RVKZHXXJQ",
                    ercUrl: "http://api-cn.etherscan.com/",
                    ftpHost: "192.168.0.122",
                    ftpPassword: "123456",
                    ftpPort: 21,
                    ftpUploadPath: "/upload/",
                    ftpUserName: "test",
                    fullPdFormula: "50/rate",
                    fullScoreFormula: "10/rate",
                    groupLogKeepDayNumber: 30,
                    halfPdFormula: "20/rate",
                    id: "4eb3865e029f495f9c8677cee17255e0",
                    isNeedInviteCode: false,
                    levelRate: 50,
                    loginValidTime: 60,
                    oneWalletRechargeNotifyUrl: "http://xulh.ngrok.wendal.cn/open/oneWallet/recharge/notify",
                    oneWalletSafeCode: "QyCqaNGPgw3hPtASm4eE6g==",
                    oneWalletToPayUrl: "https://api-tg.100scrop.tech/92-d10/SH/sendPay",
                    oneWalletToWithDrawUrl: "https://api-tg.100scrop.tech/92-d10/SH/sendWithdraw",
                    oneWalletWithDrawNotifyUrl: "http://xulh.ngrok.wendal.cn/open/oneWallet/withdraw/notify",
                    opAt: 1603347788,
                    opBy: "",
                    rebateValidLayer: 10,
                    recruitAmount: 100000,
                    serviceFee: 5,
                    superRate: 1000,
                    userChatMsgKeepDayNumber: 30,
                    withdrawFee: 1.25,
                    xindovndMerchant: "a56d0a95970f4defb43e9faa1630a601",
                    xindovndPaytype: "promptpay",
                    xindovndRechargeNotifyUrl: "http://xulh.ngrok.wendal.cn/open/xindovnd/recharge/notify",
                    xindovndSecret: "e86523fe319c4232a168b13e99984d04",
                    xindovndToPayUrl: "http://www.xindovnd.com/pay",
                    xindovndToWithdrawUrl: "http://www.xindovnd.com/transfer/apply",
                    xindovndWithdrawNotifyUrl: "http://xulh.ngrok.wendal.cn/open/xindovnd/withdraw/notify"
                },
                fileType: ['jpg', 'png', 'jpeg', 'gif'],
                formRules: {
                    emailContent: [
                        {required: true, message: '请输入邮箱内容', trigger: ['blur', 'change']},
                        {pattern: /%s/, message: '内容必须包含"%s"'}
                    ],
                    ftpUploadPath: [
                        {required: true, message: '请输入上传文件指定路径', trigger: ['blur', 'change']},
                        {pattern: /^\/.*\/$/, message: '请以"/"开头并结尾'}
                    ]
                },
            }
        },
        methods: {
            init: function () {//加载数据
                let self = this;
                console.log(111111111111);
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/sys/param/data", function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code === 0) {
                        for (let dataKey in data.data) {
                            let val = data.data[dataKey];
                            if (val != null) self.formData[dataKey] = val;
                        }
                    }
                }, "json");
            },
            doEdit: function () {
                let self = this;
                $.post(base + "/platform/sys/param/editDo", self.formData, function (data) {
                    self.$message({
                        message: data.msg,
                        type: data.code == 0 ? 'success' : 'error'
                    });
                }, "json");
            },
            forDefault: function () {
                for (let dataKey in this.defaultFormData) {
                    let value = this.defaultFormData[dataKey];
                    if (value != null) this.formData[dataKey] = value;
                }
            },
        },
        created: function () {
            console.log("init")
            this.init();
        }
    });
</script>
<!--#
}
#-->